package com.ksyun.seckill.controller.online;


import com.ksyun.seckill.config.NacosConfig;
import com.ksyun.seckill.rest.RestResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "/online/config")
@RefreshScope
public class BasisConfigController {

    @Autowired
    private NacosConfig nacosConfig;

    @Value("${sendRobot.Switch}")
    private String sendRobotSwitch;

    @Value("${use.verify.code}")
    private Boolean useVerifyCode;

    @Value("${use.dynamic.path}")
    private Boolean useDynamicPath;

    @Value("${sk.service.ver}")
    private String skServiceVer;

    @Value("${feishu.webhook.accessToken}")
    private String feiShuWebHookAccessToken;


    @RequestMapping(value = "/listBasisConfigs", method = RequestMethod.GET)
    public RestResult listBasisConfigs() {
        nacosConfig.setFeiShuWebHookAccessToken(feiShuWebHookAccessToken);
        nacosConfig.setSendRobotSwitch(sendRobotSwitch);
        nacosConfig.setUseVerifyCode(useVerifyCode);
        nacosConfig.setSkServiceVer(skServiceVer);
        nacosConfig.setUseDynamicPath(useDynamicPath);
        return RestResult.success().data(nacosConfig);
    }




}